package com.xoa.controller.hr;

import com.xoa.util.CookiesUtil;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.dataSource.ContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by gsb on 2017/11/13.
 */
@Controller
@RequestMapping("/hr/query")
public class HrStaffInfoQueryController {


    @RequestMapping("/main")
    public String main(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/queryHrMain";
    }
    @RequestMapping("/hrOn")
    public String hrOn(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/hr_on";
    }
    @RequestMapping("/hr_onLineFind")
    public String onFind(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/hr_onLineFind";
    }
    @RequestMapping("/personInfo")
    public String personInfo(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/personInfo";
    }
    @RequestMapping("/hrLeave")
    public String hrLeave(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/hr_leave";
    }
    @RequestMapping("/hr_LeaveLineFind")
    public String hrLeaveFind(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrStaffInfo/hr_leaveLineFind";
    }

    @RequestMapping("/queryHr/index")
    public String index(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrInfo/index";
    }
    @RequestMapping("/queryHr/staffPersonInfo")
    public String staffPersonInfo(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrInfo/staffPersonInfo";
    }
    @RequestMapping("/queryHr/contractInfo")
    public String contractInfo(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/queryHrInfo/contractInfo";
    }
    @RequestMapping("/attend/attendanceRecord")
    public String attendanceRecord(HttpServletRequest request) {
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        return "app/hr/attendanceRecord/attendanceRecord";
    }

    /**
     * 档案查询主页面
     * @return
     */
    @RequestMapping("/Management")
    public String Manage(){
        return "app/hr/archivesQuery/archivesQuery";
    }

    /**
     * 档案查询 在职查询
     * @return
     */
    @RequestMapping("/Query")
    public String Query(){
        return "app/hr/archivesQuery/hrArchivesQuery";
    }

    /**
     * 档案查询 显示查询信息
     * @return
     */
    @RequestMapping("/showInfo")
    public String info(){
        return "app/hr/archivesQuery/basicInfo";
    }

    /**
     * 档案查询 离职查询
     * @return
     */
    @RequestMapping("/selectLZ")
    public String select(){
        return "app/hr/archivesQuery/archivesQueryLZ";
    }
    /**
     * 档案查询 详情页面
     * @return
     */
    @RequestMapping("/details")
    public String details(){
        return "app/hr/archivesQuery/detailsPage";
    }

    /**
     * 领用物品
     * @return
     */
    @RequestMapping("/listOfItems")
    public String officeInfo(){
        return "app/hr/archivesQuery/listOfItems";
    }
}
